package edu.tum.cs.stageflow.benchmarkapplications.bitonicSort;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import edu.tum.cs.stageflow.executionframework.Flow;

public class Bitonic_Executor {

	private static final String PROPERY_FILE = "config.properties";
	private static final String CONFIG_TERMINATION = "BITONICtermination";
	private static final String CONFIG_ARRAYSIZE = "BITONICarraySize";

	public static void main(String[] args) {
		Properties prop = new Properties();
		InputStream input = null;
		int termination = 25;
		int arraySize = 25;

		try {
			input = new FileInputStream(PROPERY_FILE);
			prop.load(input);
			termination = Integer.parseInt(prop.getProperty(CONFIG_TERMINATION));
			arraySize = Integer.parseInt(prop.getProperty(CONFIG_ARRAYSIZE));
		} catch (IOException ex) {
			ex.printStackTrace();
		} finally {
			if (input != null) {
				try {
					input.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		
		 SortNetwork sortNetwork = new SortNetwork(arraySize, termination);
		 sortNetwork.getRunner().start();
		
//		Flow<Long[]> flow1 = new Flow<Long[]>();
//		Flow<Long[]> flow2 = new Flow<Long[]>();
//		Flow<Long[]> flow3 = new Flow<Long[]>();
//		Flow<Long[]> flow4 = new Flow<Long[]>();
//		Generator gen = new Generator(flow1, flow2, flow3, flow4);
//		gen.getRunner().run();
		
		/*
		try {
			Thread.sleep(2000);
		} catch (Exception e) {
			// TODO: handle exception
		}
		for (int i = 0; i < 20; i++) {
			flow1.remove();
			flow2.remove();
			flow3.remove();
			flow4.remove();
		}
		*/
	}

}
